package com.study.java.jinjie.GUI.binary.ui;

import javax.swing.*;
import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;

import static com.study.java.jinjie.GUI.binary.ui.Setting.*;

/**
 * @Author: MuMu
 * @Date: 2024/4/7 22:27
 */
public class HighlightFocusListener implements FocusListener {

    @Override
    public void focusGained(FocusEvent e) {
        ((JTextField) e.getSource()).setBackground(Input_focus_color);
        ((JTextField) e.getSource()).setBorder(BorderFactory.createLineBorder(Input_border_color2, 2,true));
    }

    @Override
    public void focusLost(FocusEvent e) {
        // Reset background color of unfocused text field to default color
        ((JTextField) e.getSource()).setBackground(Main_color);
        ((JTextField) e.getSource()).setBorder(BorderFactory.createLineBorder(Input_border_color, 1,true));
    }

}
